summaryrefslogtreecommitdiff
path: root/src/pages/[locale]/furthsettins/scotsoun/[scotsounId]/index.astro
blob: a64156120db08f83418de6bd8a9af746d83527e8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
---
import Page from '$layouts/Page.astro';
import localeStaticPaths from '$lib/localeStaticPaths';
import tPage from '$i18n/translations/pages/scotsounGallery';
import translate from '$i18n/translate';
import type Locale from '$types/Locale';
import { getScotsoun } from '$data/scotsoun';
import type ScotsounId from '$types/ScotsounId';
import Scotsoun from '$components/Scotsoun.astro';

export async function getStaticPaths() {
  const scotsounIds = Object.keys(getScotsoun) as `${ScotsounId}`[];
  return scotsounIds.flatMap((n) =>
    localeStaticPaths.map((p) => ({ ...p, params: { ...p.params, scotsounId: n } }))
  );
}

const locale = Astro.params.locale as Locale;
const scotsounId = Astro.params.scotsounId as ScotsounId;
const t = translate(locale);

const scotsoun = await getScotsoun[scotsounId]();
---

<Page title={t(tPage, { key: 'title' })}>
  <Scotsoun scotsoun={scotsoun} />
</Page>